using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Text;
using System.Security.Cryptography;

using NHibernate.Expression;
using Adge.Models;
using Adge.BLL;
using Adge.Common;


namespace Adge.Web.UI.DesktopModules.Html
{
    public partial class monoShow : System.Web.UI.UserControl
    {

        string InternalId
        {
            get
            {
                string id = Request.Path + this.ClientID;

                return Utils.MD5(id);
            }
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {
                InitLayout();
            }            
        }

        void InitLayout()
        {
            if (Request.IsAuthenticated)
            {
                pnEdit.Visible = true;
                lnkEditGo.NavigateUrl = "~/admin/contentEdit.aspx?cmd=edit&newsid=" + InternalId + "&path=" + Request.Path;
            }
            else
            {
                pnEdit.Visible = false;
            }

            AdgeArBase<NewsInfo> newslist = new AdgeArBase<NewsInfo>();
            Order[] order = new Order[] { };
            ICriterion[] criterias = new ICriterion[] { new EqExpression("InternalId", InternalId) };
            NewsInfo[] entities = newslist.SlicedFindAll(0, 1, order, criterias);
            if (entities.Length > 0)
            {
                litContent.Text = entities[0].Content;
            }

        }

    }



}